package me.tuyou.jvm.book;

import java.util.ArrayList;
import java.util.List;

public class HeapChangeProcess {

	static class OOMObject{
		public byte[] placeholder = new byte[64 * 1024];
	}
	
	public static void test() throws InterruptedException{
		
		List<OOMObject> list = new ArrayList<>();
		for(int i = 0; i < 1000; i++){
			Thread.sleep(50);
			list.add(new OOMObject());
		}
		System.out.println("---gc---");
		System.gc();
	}
	
	public static void main(String[] args) throws InterruptedException {

		test();
	}
}
